package com.wenjiang.controller;

import com.wenjiang.common.annotation.OperatorLog;
import com.wenjiang.common.dto.ChangeRoleResourcesParam;
import com.wenjiang.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/permission")
public class PermissionController {

    @Autowired
    PermissionService permissionService;


    //获取所有资源
    @RequestMapping("/getAll")
    public Object getAllResource(){
        return permissionService.getAllPermission();
    }

    // 修改某个角色操作后台资源的权限
    @RequestMapping("/change")
    @OperatorLog
    public  Object changeRoleResource(@RequestBody ChangeRoleResourcesParam changeRoleResourcesParam){
        return  permissionService.changeRoleResource(changeRoleResourcesParam);
    }
}
